package _022_2_15

func tribonacci(n int) int {
	arr := make([]int, n+1)

	if n == 0 {
		return 0
	}

	if n == 1 {
		return 1
	}

	if n == 2 {
		return 2
	}

	for i := 0; i < len(arr); i++ {
		arr[i] = arr[i-1] + arr[i-2] + arr[i-3]
	}

	return arr[len(arr)-1]

}
